package com.zteman.android.hdp;

import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.View;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;

import java.util.ArrayList;
import java.util.List;

public class MainActivity extends AppCompatActivity {

    private RecyclerView mRvList;
    private List<VideoModel> mVideos =new ArrayList<>();

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        mVideos.add(new VideoModel("中央4套","http://flv106.v1.cn/cloud/20130604/605305.flv"));
        mVideos.add(new VideoModel("hks","rtmp://live.hkstv.hk.lxdns.com/live/hks"));
        mRvList = (RecyclerView) findViewById(R.id.rv_list);
        mRvList.setLayoutManager(new LinearLayoutManager(this));
        BaseQuickAdapter<VideoModel, BaseViewHolder> mAdapter = new BaseQuickAdapter<VideoModel, BaseViewHolder>(R.layout.item_video_list, mVideos) {
            @Override
            protected void convert(BaseViewHolder helper, VideoModel item) {
                helper.setText(R.id.textView, item.getTitle());
            }
        };
        mRvList.setAdapter(mAdapter);
        mAdapter.setOnItemClickListener(new BaseQuickAdapter.OnItemClickListener() {
            @Override
            public void onItemClick(BaseQuickAdapter adapter, View view, int position) {

            }
        });
    }
}
